import { request } from "@/utils"
import { message } from "antd"

export function getProcess () {
  return request({
    url: '/get-process',
    headers: {
      isLoading: false
    }
  }).catch(error => {
    // console.log(error.message)
    message.error('网络异常，请开启服务器')
  })
}


export function addProcess (formData) {
  return request({
    url: '/add-process',
    method: 'POST',
    data: formData,
    headers: {
      isLoading: false
    }
  })
}

export function delProcess (id) {
  return request({
    url: '/delete-process',
    method: 'POST',
    data: {
      id
    }
  }).then(() => {
    message.success('删除成功')
  }).catch(() => {
    message.error('删除失败')
  })
}

export function getProcessById (id, key) {
  return request({
    url: 'get-result',
    params: {
      id,
      key
    }
  })
}
